home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / faq / amsls497.zip / AMOSLIST / 000129_amos-request@svcs1.digex.net_Wed Apr 16 12:39:14 1997.msg < prev    next >
Internet Message Format  |  1997-05-01  |  3KB

  1. Received: from svcs1.digex.net (svcs1.digex.net [204.91.197.224])
  2.     by mail3.access.digex.net (8.8.5/8.8.5) with ESMTP id MAA19903
  3.     for <mcox@access.digex.net>; Wed, 16 Apr 1997 12:39:12 -0400 (EDT)
  4. Received: (from daemon@localhost)
  5.     by svcs1.digex.net (8.8.5/8.8.5) id KAA27945
  6.     for amos-out; Wed, 16 Apr 1997 10:20:53 -0400 (EDT)
  7. Received: from mail3.access.digex.net (mail3.access.digex.net [205.197.247.4])
  8.     by svcs1.digex.net (8.8.5/8.8.5) with ESMTP id KAA27942
  9.     for <amos-list@svcs1.digex.net>; Wed, 16 Apr 1997 10:20:52 -0400 (EDT)
  10. Received: from red.paston.co.uk (red.paston.co.uk [194.129.188.3])
  11.     by mail3.access.digex.net (8.8.5/8.8.5) with ESMTP id KAA01566
  12.     for <amos-list@access.digex.net>; Wed, 16 Apr 1997 10:20:50 -0400 (EDT)
  13. Received: from paston.co.uk ([194.129.188.201]) by red.paston.co.uk with SMTP id <843313-141>; Wed, 16 Apr 1997 15:18:35 +0100
  14. From: Ben Wyatt <bwyatt@paston.co.uk>
  15. To: amos-list@access.digex.net
  16. Date:     Wed, 16 Apr 1997 00:17:15 -0000
  17. Message-ID: <yam7045.792.3829552@194.129.188.3>
  18. In-Reply-To: <861139415.0918137.0@h144.redrose.net>
  19. X-Mailer: YAM 1.3.4 [020] - Amiga Mailer by Marcel Beck
  20. Subject: Re: Line problems
  21. MIME-Version: 1.0
  22. Content-Type: text/plain
  23. Status: O
  24. X-Status: 
  25.  
  26. On 15-Apr-97, Mush sat on a keyboard and produced this mess:
  27.  
  28. > >> OK, ill try and explain this problem again. Im making a perspective
  29. > >> box/rectangle, so naturally, one end will be close, and the other end
  30. > >> smaller, so simulate the depth of the box. Here is an example: (crap
  31. > ASCII art)
  32. > >> 
  33. > >>                        |
  34. > >>                        |
  35. > >>                        |                                  |
  36. > >>                        |                                  |
  37. > >>                        |
  38. > >>                        |
  39.  
  40. > >Surely, if you have already drawn the vertical lines on screen, all the
  41. > >necessary co-ords will be contained within the variables that set them?
  42. > >
  43. > >Or have I mis-understood?
  44.  
  45. > I know the top coords of the 2 lines drawn, but it is the top and bottom Y
  46. > coordinates on the actual SLOPES that I need to know quickly
  47.  
  48. OK, I think I understand this problem now. Hopefully, this program
  49. should solve your problem...
  50.  
  51. X1=10     : X2=95     : Rem Left and right edge x positions
  52. YTOP1=30  : YTOP2=50  : Rem Top coordinates
  53. YBOT1=150 : YBOT2=115 : Rem Bottom coordinates 
  54.  
  55. ' Draw verticle sides  
  56. Draw X1,YTOP1 To X1,YBOT1
  57. Draw X2,YTOP2 To X2,YBOT2
  58.  
  59. ' Get gradients of lines (*256 so it is int and power of 2 for speed)
  60. GRADTOP=(256*(YTOP2-YTOP1))/(X2-X1)
  61. GRADBOT=(256*(YBOT2-YBOT1))/(X2-X1)
  62.  
  63. For X=X1 To X2
  64.    ' Get coordinates at current x position
  65.    YTOP=YTOP1+((X-X1)*GRADTOP)/256
  66.    YBOT=YBOT1+((X-X1)*GRADBOT)/256
  67.    ' Plot the top and bottom points 
  68.    Plot X,YTOP
  69.    Plot X,YBOT
  70. Next X
  71.  
  72. Bye ____________________________________________________
  73.    /                                                    \
  74.   / Ben Wyatt - bwyatt@paston.co.uk or b.wyatt@uea.ac.uk \
  75.   \   http://www.paston.co.uk/users/bwyatt/index.html    /
  76.    \____________________________________________________/
  77.         (c)1995-97 Very Interesting Signatures Ltd.
  78.